<template>
	<view style="position: sticky; top: 0; z-index: 99;">
		<view class="flex flex-row justify-between align-center" style="background-color: #b987ff; padding: 20rpx 20rpx;">
			<i class="el-icon-arrow-left" @click="back" style="font-size: 38rpx; color: aliceblue;"></i>
			<view style="font-size: 30rpx; font-weight: bold; color: white; margin-left: 50rpx;">
				{{nav_title}}
			</view>
			<view class="flex justify-center align-center" v-if="role == '老师'" @click="buy"
			style="color: #b987ff; font-size: 26rpx; background-color: #ffffff;width: 100rpx; height: 50rpx; border-radius: 25rpx;">
				下单
			</view>
			<view class="" v-else>
				<i class="el-icon-arrow-left" style="opacity: 0;"></i>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		name: "navbar",

		data() {
			return {

			};
		},

		props: {
			nav_title: String,
		    role:String
			
		},

		methods: {
			back() {
				uni.navigateBack()
			},
			buy(){
				this.$emit('buy')
			}
		}
	}
</script>

<style>

</style>